package toy.keli.picmap.model;

import java.util.HashMap;
import java.util.Map;

public class path extends  Model{
    public String path;
    public int count;
    public long intime;
    public long uptime;
    public path(int id) {
        super(id);
    }
    public path(String name) {
        super();
        this.findOne("path='"+name+"'");
        path=name;
        if(this.id==0) this.save();
    }

    @Override
    public boolean save() {
        Boolean rt=super.save();
        if(path!=null)this.findOne("path='"+path+"'");
        return rt;
    }

    static Map<String,path> map=new HashMap<String,path>();
    public static path get(String name){
        path rt=map.get(name);
        if(rt!=null) return rt;
        rt=new path(name);
        map.put(name,rt);
        return rt;
    }
    public path() {
        super();
    }

    public void add(int add) {
        this.count+=add;
        this.save();
    }
}
